//package com.boot.config;
//
//import java.util.HashMap;
//import java.util.Map;
//
//import javax.persistence.EntityManagerFactory;
//import javax.sql.DataSource;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.orm.jpa.EntityScan;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Primary;
//import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
//import org.springframework.orm.jpa.JpaTransactionManager;
//import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
//import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
//import org.springframework.transaction.PlatformTransactionManager;
//import org.springframework.transaction.annotation.EnableTransactionManagement;
//
//@Configuration
////此处是你dao文件所在的包名
//@EnableJpaRepositories(basePackages ="com.boot.business.**.dao")
//@EnableTransactionManagement
//public class JpaConfig {
//
//  @Autowired
//  private DataSource dataSource;
//
//  @Bean
//  public EntityManagerFactory entityManagerFactory() {
//      HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
//      System.out.println(vendorAdapter.getJpaDialect());
//      System.out.println(vendorAdapter.getPersistenceProvider());
//      System.out.println(vendorAdapter.getJpaPropertyMap());
//      vendorAdapter.setShowSql(true);
//      LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
//      factory.setJpaVendorAdapter(vendorAdapter);
//      //此处com.example.*.model是你的java bean所在的包名
//      factory.setPackagesToScan("com.boot.business.**.entity");
//      factory.setDataSource(dataSource);
//      Map<String, Object> jpaProperties = new HashMap<String, Object>();
//      jpaProperties.put("hibernate.ejb.naming_strategy","org.hibernate.cfg.ImprovedNamingStrategy");
//      jpaProperties.put("hibernate.jdbc.batch_size",50);
//      System.out.println("================JPA 工厂==================");
//      factory.setJpaPropertyMap(jpaProperties);
//      factory.afterPropertiesSet();
//      return factory.getObject();
//  }
//
//  @Bean
//  public PlatformTransactionManager transactionManager() {
//      JpaTransactionManager txManager = new JpaTransactionManager();
//      txManager.setEntityManagerFactory(entityManagerFactory());
//      return txManager;
//  }
//}